{layout name="layout" /}
<div class="row">
    <div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-heading">菜单编辑:ID[{$ruleRow.id}]</div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-sm-8">
                        <form action="{:url('admin/rule/edit',['id'=>$ruleRow['id']])}" class="form-horizontal ajax-form" method="post" name="rule">
                            <div class="form-group">
                                <label for="inputparent_id" class="col-sm-3 control-label">上级菜单</label>
                                <div class="col-sm-5">
                                    <select name="parent_id" id="inputparent_id" class="form-control">
                                        <option value="0">顶级菜单</option>
                                        {volist name="ruleRows" id="vo"}
                                        <option value="{$vo.id}" {if condition="$vo['id'] eq $ruleRow['parent_id']" } selected="selected" {/if}>{$vo.title}</option>
                                        {volist name="$vo->parent" id="v"}
                                        <option value="{$v.id}"  {if condition="$v['id'] eq $ruleRow['parent_id']" } selected="selected" {/if}>------{$v.title}</option>
                                        {/volist}
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputTitle" class="col-sm-3 control-label">菜单名称</label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control" name="title" id="inputTitle" value="{$ruleRow.title}" placeholder="菜单名称">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputName" class="col-sm-3 control-label">菜单链接</label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control" name="name" id="inputName" value="{$ruleRow.name}" placeholder="菜单链接"> </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="inputIcon"> ICON图标 </label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control" name="icon" id="inputIcon" value="{:$ruleRow->getData('icon')}" placeholder="ICON图标"> </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="inputislink"> 是否菜单链接 </label>
                                <div class="col-sm-5">
                                    <input type="checkbox" name="islink" id="inputislink" value="1" 
                                    {if condition="$ruleRow->getData('islink') eq 1"}
                                    checked="checked" 
                                    {/if}
                                    /> </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="inputSort"> 排序 </label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control " name="sort" value="{:$ruleRow->getData('sort')}" id="inputSort" placeholder="越小越靠前">
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-3 col-sm-9">
                                    <button type="submit" class="btn btn-primary">提交</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
$(function(argument) {
    $('form.ajax-form').formLuffyZhao([{
        name: "parent_id",
        display: '上级菜单',
        rules: 'required|integer'
    }, {
        name: "title",
        display: "菜单名称",
        rules: "required"
    }, {
        name: "name",
        display: "菜单链接",
        rules: "required|rule_name"
    }, {
        name: "sort",
        display: "排序",
        rules: "required|integer"
    }]);
});
</script>
